<script setup lang="ts">
import { ConfigStore } from '@src/store/config.store'
import { useRoute } from 'vue-router'
import { setPageTitle } from '@src/hooks/index'
import TreeSubMenu from './TreeSubMenu.vue'
const routes = useRoute()
const store = ConfigStore()
const curve = ref<string>('/home')
watch(
  () => routes,
  (newV) => {
    curve.value = newV.fullPath
    if (newV.meta.title) {
      setPageTitle(newV?.meta?.title as string)
    } else {
      setPageTitle('一条鱼')
    }
  },
  {
    deep: true,
    immediate: true,
  },
)
</script>
<template>
  <ElMenu :default-active="curve" active-text-color="#ffd04b" background-color="#545c64" text-color="#fff" :collapse="store.expand">
    <TreeSubMenu></TreeSubMenu>
  </ElMenu>
</template>
<style lang="scss" scoped></style>
